<?
$cDirectory = getParam('d');
$cFile = getParam('f');
$nType = getParam('t');
$cLang= getParam('l');
$aExtensiones = array ( 1 => 'jpg', 2 => 'pdf', 3 => 'mp3' , 4 => 'zip' );
$aContentType= array ( 1 => 'image/jpeg', 2 => 'application/pdf', 3 => 'audio/mpeg3' , 4 => 'application/zip' );
if ( $cLang ) $cFile .= '_' . $this->getLanguage();
$cArchivo = PATH_FILES . '/' . $cDirectory . '/' . $cFile . '.' . $aExtensiones [$nType];
if ( file_exists($cArchivo) ) 
{
	$this->aDatos[$cTemplateId][cArchivo]  = $cArchivo;
	
	$bIsLogged = $this->oUserSession->isLogged();
	if ( $bIsLogged  )
	{
		$fp = fopen($cArchivo, 'rb');
		// send the right headers
		header("Content-Type: " . $aContentType[$nType] );
		header("Content-Length: " . filesize($cArchivo));
		header("Content-Disposition: attachment; filename= $cFile" . '.' . $aExtensiones [$nType] );
		fpassthru($fp);
		exit();
	}
}
?>